# -*- coding: utf-8 -*-
# ʱ�� 2024-9-19 15:53
class Result:
    def __init__(self, code=0, msg='', data=None):
        self.code = code
        self.msg = msg
        self.data = data

    @staticmethod
    def success(data=None):
        return Result(code=1, msg='success', data=data)

    @staticmethod
    def error(msg):
        return Result(code=0, msg=msg)

    def to_dict(self):
        return {
            'code': self.code,
            'msg': self.msg,
            'data': self.data
        }
